function fig7_6

% solve: r=-exp(lam*r) where r=A+iB
clf

global lam

N=8000;
lam=exp(-1);

AA(1)=-exp(1);
BB(1)=0;

ep=0.001;
lam=lam+ep;
B=sqrt(2)*exp(1.5)*ep^0.5;
A=AA(1)+5*exp(2)*ep/3;
for i=1:N
    %B=solve(@f,0.0001,pi-0.001);
    if AA(i)>0
        B=solve(@f,0.5*B,B);
    else
        B=solve(@f,0.0001,pi-0.001);
    end
    AA(i+1)=-B*cos(lam*B)/sin(lam*B);
    BB(i+1)=B;
    if lam>12
        break
    end
    lam=lam+0.001;
    if B<1
        lam=lam+0.001;
    else
        lam=lam+0.01;
    end
end
lam

figure(1)
% get(gcf)
set(gcf,'Position', [25 1115 658 230])
clf
plot(AA,BB,'b','LineWidth',1.1)
hold on
plot([-2*exp(1) -1],[0 0],'b','LineWidth',1.1)
box on
grid on
plot(AA,-BB,'b','LineWidth',1.1)
plot([-exp(1) 0.5],[0 0],'k','LineWidth',0.4)
plot([0 0],[-2 2],'k','LineWidth',0.4)
axis([-5 0.41 -2 2])

set(groot,'defaultAxesTickLabelInterpreter','latex');
set(gca,'XTick',[-exp(1) -1 0])
set(gca,'XTickLabel',{'$-e$';'$-1$';'0'})

set(gca,'YTick',[-2 -1 0 1 2])
%set(gca,'YTickLabel',{'$\pi/2$';'$-1$';'0';'$1$';'$\pi/2$'})

arrowhead([-exp(1)+0.9 -exp(1)+0.85],[0 0],'b',[0.8 1.5],2);
arrowhead([-exp(1)-1.2 -exp(1)-1.15],[0 0],'b',[0.8 1.5],2);
ii=30;
arrowhead([AA(ii) AA(ii+1)],[BB(ii) BB(ii+1)],'b',[0.8 1.5],2);
arrowhead([AA(ii) AA(ii+1)],[-BB(ii) -BB(ii+1)],'b',[0.8 1.5],2);

set(gca,'ytick',[-2 -1 0 1 2])
set(gca,'YTickLabel',{'$-2$';'$-1$';'0';'1';'2'})

ax = gca;
ax.XAxis.TickLabelInterpreter = 'latex';
ax.YAxis.TickLabelInterpreter = 'latex';
set(gca,'FontSize',13)

xlabel('$A$','Interpreter','latex','FontSize',14)
ylabel('$B$','Interpreter','latex','FontSize',14)
%exportgraphics(gca,'/Users/mark/Desktop/delay.pdf')

function z=f(b)
global lam
A=-b*cos(lam*b)/sin(lam*b);
z=b-exp(-lam*A)*sin(lam*b);

